<template>
  <!-- <main class="px-4 py-10 text-center text-gray-700 dark:text-gray-200">
    <router-view />
    <Footer />
    <div class="mt-5 mx-auto text-center opacity-25 text-sm">[Default Layout]</div>
  </main> -->
  <!-- <main class="px-4 py-10 text-center text-gray-700 dark:text-gray-200">
    <div class="w-1/4 m-auto text-center text-gray-300 bg-teal-800">
      Default Layout222222222222222222222233dasf
    </div>
    <router-view />
  </main> -->
  <el-container class="h-full">
    <el-header height="40px" class="bg-teal-800 text-center text-gray-300">header </el-header>
    <el-container>
      <el-aside width="200px" class="h-full">
        <el-menu
          active-text-color="#ffd04b"
          background-color="#545c64"
          router
          :default-active="'/' + $route.name?.toString()"
          text-color="#fff"
          class="h-full"
        >
          <el-sub-menu v-for="item in menus" :key="item.url" :index="item.title">
            <template #title>
              <span>{{ item.title }}</span>
            </template>
            <el-menu-item v-for="itm in item.subMenus" :key="itm.url" :index="itm.url">
              <span>{{ itm.subTitle }}</span>
            </el-menu-item>
          </el-sub-menu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-main class="flex flex-col">
          <!-- <router-view v-slot="{ Component, route }">
            <transition name="slide">
              <component :is="Component" :key="route" />
            </transition>
          </router-view> -->
          <!-- <router-view /> -->
          <router-view v-slot="{ Component, route }">
            <keep-alive>
              <component :is="Component" :key="route.name" />
            </keep-alive>
          </router-view>
        </el-main>
        <el-footer height="40px" class="test">Footer</el-footer>
      </el-container>
    </el-container>
  </el-container>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const menus = [
  {
    title: '测试',
    url: '/',
    icon: null,
    subMenus: [
      {
        subTitle: '用户',
        url: '/user',
      },
      {
        subTitle: '角色',
        url: '/role',
      },
    ],
  },
  {
    title: '组件',
    url: '/comp',
    icon: null,
    subMenus: [
      {
        subTitle: '按钮',
        url: '/btn',
      },
      {
        subTitle: '表格',
        url: '/table',
      },
      {
        subTitle: '表单',
        url: '/form',
      },
      {
        subTitle: '流式',
        url: '/stream',
      },
      {
        subTitle: 'roi',
        url: '/roi',
      },
      {
        subTitle: 'markdown',
        url: '/markdown',
      },
    ],
  },
]
</script>
<style lang="scss">
.test {
  background-color: $injectedColor;
}
</style>
